<pre>
<?php 
session_start();
$empid = 'JG-MARFI';
require_once("include.php");
$emplist = sqlreadarray("select distinct empid from twork order by empid");
foreach ($emplist as $id=>$empid) {
 $empid = $empid[0];
 echo "Dealing with $empid \n";

 $sql = "select itemid,processid,unix_timestamp(starttime),unix_timestamp(endtime) from twork where empid = '$empid' and processid = 'ATT' order by starttime";
 $arr = sqlreadarray($sql);

 $sql2 = "select itemid,processid,unix_timestamp(starttime),unix_timestamp(endtime) from twork where empid = '$empid' and processid <> 'ATT'  order by starttime";
 $arr2 = sqlreadarray($sql2);

}

?>